/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.socket.server.business_service_components;

import com.socket.server.business_entities.Motor;
import com.socket.server.data_access_components.MotorDAO;
import java.util.List;

/**
 *
 * @author CongChinh
 */
public class MotorService {
    private MotorDAO db;
    public MotorService() {
        db = new MotorDAO();
    }    
    /**SELECT
     * if (success)
     * @return a list of motors, else return null
     */
    public List selectMotors() {
        //call data access layer's service - selectMotors()
        return db.selectMotors();
    }
    /**SELECT
     * if (success)
     * @return a motor
     */
    public Motor selectMotorById(String id) {
        return db.selectMotorById(id);
    }
    /**ADD
     * if (success)
     * @return 1, else 0
     */
    public int addMotor(Motor motor) {
        //call data access layer's service - addMotor()
        int i = db.addMotor(motor);
        return i;
    }
    /**UPDATE
     * if (success)
     * @return 1, else 0
     */
    public int updateMotor(Motor motor) {
        //call data access layer's service - updateMotor()
        int i = db.updateMotor(motor);
        return i;
    }
    /**DELETE
     * if (success)
     * @return 1, else 0
     */
    public int deleteMotor(Motor motor) {
        //call data access layer's service - deleteMotor()
        int i = db.deleteMotor(motor);
        return i;
    }
}
